home *** CD-ROM | disk | FTP | other *** search
Wrap
'This script exports an STL file to a service bureau 'STL FTP SEND Script -- 'This script exports any Solid selected to a Stereolithography (STL) file and sends it, 'along with some user information, via FTP to any one of 5 STL Service Bureaus. The goal is to 'facilitate and expedite the file transfer between customers and STL sites for estimates or orders. ' '************************************************************************************************ '*********************************** STL FTP SEND Script *************************************** '************************************************************************************************ ' 'April 22, 1996 ' ' This script exports a Stereolithography(STL) file for any Solids created in CorelCAD. ' The STL file is then transmitted via FTP to the Service Bureau Selected. We assume that you ' have TC\PIP protocol installed and that you are connected to an internet provider that supports ' the TC\PIP protocol. ' ' The user defines: ' - File name of Exported file(*.STL) to be created ' - User Information: Name, company name, address, phone, fax, E-mail ' - One Service Bureau. ' - Additional comments or instructions '************************************************************************************************ '************************************************************************************************ '************************************************************************************************ '************************************************************************************************ ' Additional Comments: ' ' - First Create and save your solid model. ' - Run the STLScript.csc from Tools menu\Script\run script ' - Enter your info in the Left half of the "FTP delivery to STL Service Bureau" ' Dialog ' - In the right half of the "FTP delivery to STL Service Bureau" dialog enter: ' Your Name, Your company name, Your address, Your phone, Your fax, Your E-mail. ' - The file name to be exported (NOTE: to prevent unexpected results keep the ' file name down to seven letters.) ' - Select the Service Bureau by clicking on the "change button" ' - From the "STL Service Bureau" dialog select the Service Bureau of your choice ' (NOTE: To update the Service Bureau information click on the "update" button ' - Each Service Bureau has a phone number and a contact name in case you need to ' setup an individual account. ' - Once you have selected the Service Bureau of your choice click "ok" to return. ' If you are sending information to a Service Bureau which is not listed then simply ' add the FTP address information manually. ' - Add comments or instructions to Service Bureau in the Comments section at the ' bottom right of the "FTP delivery to STL Service Bureau" dialog. ' - Update to refresh the information. ' - Click on Send and sit back and enjoy the scenery. (It may take a long time with some ' of the bigger files. High refinement settings will slow down the export of your file, ' but will give you a more accurate solid.) ' ' '************************************************************************************************ '************************************************************************************************ 'Written by Jean-Louis Marin and David Climie, ⌐ 1995-96 Corel Corporation. All rights reserved. '************************************************************************************************ '************************************************************************************************ '************************ DECLARATIONS ********************************************* '************************************************************************************************ '************************************************************************************************ DECLARE FUNCTION WinExec LIB "kernel32" (BYVAL path AS STRING, BYVAL shw AS LONG) AS LONG ALIAS "WinExec" DECLARE SUB DOSEND() DECLARE SUB DODSYS() DECLARE SUB FIN() DECLARE SUB DOUPDATE() DECLARE SUB MakeFTPFile() DECLARE SUB MakeUserFile() DECLARE SUB ExportSTLFile() REM DECLARE FUNCTION CountFTPFiles%(FName$) Global Comp% Comp = 1 Global Company$(5) Company$(1) = "Alta Precision" Company$(2) = "Advantage Engineering" Company$(3) = "Concept Plus" Company$(4) = "EDI" Company$(5) = "Factotum" Global Complex$(5,4) Complex$(1,1)= "204.101.187.2" Complex$(1,2)= "alta" Complex$(1,3)= "alta11120" Complex$(1,4)= "\alta" Complex$(2,1)= "" Complex$(2,2)= "" Complex$(2,3)= "" Complex$(2,4)= "" Complex$(3,1)= "139.13.16.161" Complex$(3,2)= "concept" Complex$(3,3)= "concept" Complex$(3,4)= "\Incoming" Complex$(4,1)= "" Complex$(4,2)= "" Complex$(4,3)= "" Complex$(4,4)= "" Complex$(5,1)= "shell.inforamp.net" Complex$(5,2)= "Factotum" Complex$(5,3)= "sla250" Complex$(5,4)= "" GLOBAL FileName$ GLOBAL FileNamee$ GLOBAL Con$ GLOBAL Conn$ Con$ = CHR(13)+ CHR(10) Conn$ = CHR(13) GLOBAL UserName$ ' GLOBAL CompanyName$ GLOBAL Address$ GLOBAL PhoneNumber$ GLOBAL FaxNumber$ GLOBAL Email$ GLOBAL commentTxt$ GLOBAL ErrorVar% 'Used to make sure user enters a correct path name UserName$ = "UserName" CompanyName$ = "Company Name" Address = "Address" PhoneNumber = "(555)555-5555" FaxNumber = "(555)555-5555" Email = "EMail@Site.Ca" FileName = "Default" commentTxt = "Add comments to Service Bureau Here." START: BEGIN DIALOG StartDia 334, 216, "FTP delivery to STL Service Bureau " PUSHBUTTON 280, 56, 40, 14, "Change" PUSHBUTTON 180, 190, 40, 14, "Update" PUSHBUTTON 230, 190, 40, 14, "Send" CANCELBUTTON 280, 190, 40, 14 TEXTBOX 14, 25, 140, 14, UserName$ TEXTBOX 14, 55, 140, 13, CompanyName$ TEXTBOX 14, 84, 140, 14, Address$ TEXTBOX 14, 115, 140, 14, PhoneNumber$ TEXTBOX 14, 145, 140, 14, FaxNumber$ TEXTBOX 14, 175, 140, 13, Email$ TEXTBOX 180, 25, 140, 14, FileName$ TEXTBOX 180, 56, 97, 14, Company(Comp) 'Company(Comp) TEXTBOX 216, 73, 104, 13, Complex(Comp,1) 'Complex(Comp,1) TEXTBOX 216, 89, 104, 13, Complex(Comp,2) 'Complex(Comp,2) TEXTBOX 216, 105, 104, 13, Complex(Comp,3) 'Complex(Comp,3) TEXTBOX 215, 120, 104, 12, Complex(Comp,4) 'Complex(Comp,4) TEXTBOX 180, 147, 140, 27, commentTxt$ GROUPBOX 170, 180, 160, 30, "" ' put "" after this one GROUPBOX 174, 3, 160, 133, "File Information:" TEXT 180, 15, 50, 8, "File Name:" TEXT 14, 164, 133, 8, "E-mail" TEXT 14, 135, 133, 8, "Fax:" TEXT 14, 105, 134, 8, "Phone" TEXT 14, 75, 133, 8, "Address" TEXT 14, 44, 133, 8, "Company Name:" TEXT 14, 15, 133, 8, "User Name:" GROUPBOX 4, 0, 160, 210, "User Information:" TEXT 180, 44, 120, 8, "STL Service Bureau:" GROUPBOX 170, 137, 160, 43, "Comments" TEXT 176, 75, 26, 8, "TC/PIP:" TEXT 176, 89, 38, 8, "User Name:" TEXT 176, 105, 38, 8, "Password:" TEXT 176, 123, 37, 8, "Path Name:" END DIALOG return = DIALOG(StartDia) 'Runs the dialog box If return = 2 then stop 'If the user presses ESC, cancels the script If (UserName$ = "") or (Phonenumber$ = "") then BEGIN DIALOG ErrorVarDiaa 120, 90, "Error" TEXT 15, 6, 90, 13, "INCORRECT FORMAT !!!!" TEXT 5, 24, 110, 36, "Corel Script has detected that your Name or Phone number have not been entered. Please verify, and add them to the User Information." OKBUTTON 10, 70, 40, 14 CANCELBUTTON 70, 70, 40, 14 END DIALOG ret = DIALOG(ErrorVarDiaa) Goto Start endif ErrorVar = False FileName = LTRIM(FileName) FileName = RTRIM(FileName) FileName = UCASE(FileName) If (cbol(instr(FileName,":"))=true) or (cbol(instr(FileName,"\"))=true) then ErrorVar = true If NOT((Right(FileName,4))=".STL") then FileName=FileName & ".STL" PosPeriod = 0 If (PosPeriod <>0) and UCASE(right(FileName,4)) <> ".STL" then ErrorVar = True REM ErrorVar = FALSE '*** TAKE OUT REM IF YOU WANT TO OVERIDE ERROR TRAP *** If ErrorVar = true then BEGIN DIALOG ErrorVarDia 194, 123, "Error" TEXT 24, 0, 170, 12, "INCORRECT FORMAT !!!!" TEXT 22, 15, 142, 33, "Corel Script has detected that your FILE NAME entry is invalid. Please verify, and change accordingly." GROUPBOX 22, 49, 143, 43, "Examples " OKBUTTON 22, 100, 40, 15 CANCELBUTTON 123, 100, 40, 15 TEXT 32, 62, 52, 8, "Widget1.SLT" TEXT 98, 62, 48, 8, "Widget" TEXT 33, 76, 112, 8, "Rotating Coil.SLT" END DIALOG ret = DIALOG(ErrorVarDia) If ret = 2 then STOP FileName = "Default.STL" Goto Start ENDIF If return = 3 then 'Updates the variables DODSYS goto start elseIf return = 4 then DOUPDATE goto start elseIf return = 5 then DOSEND FIN endif FileName = "C:\TEMP\" & FileName message filename WITHOBJECT "CorelCAD.Automation.1" .setvisible -1 .FileExport FileName,769,1000,700, 85, 85, 4 END WITHOBJECT '************************************************************************************************ '************************************************************************************************ '************************************************************************************************ SUB DODSYS DIM FA1$ DIM FA2$ DIM CompInfo$(7) FA1 = "Factotum Plastics Technology" FA2 = "Mississauga, Ontario" FA3 = "Call to get your" & con$ & "personal FTP account" CompInfo$(1) = "Alta Precision Prototypes" & con$ & "1120 Rue Colbert" & con$ & "Ville D'Anjou, Quebec" & con$ & "Canada" & con$ & "H1J 2S1" & con$ & "Phone: (514) 353-0919" & con$ & "Fax: (514) 353-3599" & con$ & "Contact: Guillermo Alonso Jr." CompInfo$(2) = "Advantage Engineering" & con$ & "2500 Central Ave." & con$ & "Windsor, Ontario" & con$ & "Canada" & con$ & "N8W 4J5" & con$ & "Phone: (519) 974-7366" & con$ & "Fax: (519) 974-8850" & con$ & "Contact: Steve Hengsperger" & con$ & FA3 CompInfo$(3) = "Concept Plus" & con$ & "180 Blv St-George" & con$ & "Moncton,New Brunswick" & con$ & "Canada" & con$ & "E1E 4K7" & con$ & "Phone: (506) 858-4153" & con$ & "Fax: (506) 858-4075" & con$ & "Contact: Willam LeBlanc" CompInfo$(4) = "EDI" & con$ & "510 Front St. West" & con$ & "Toronto, Ontario" & con$ & "Canada" & con$ & "M5V 1B8" & con$ & "Phone: (416) 593-4663" & con$ & "Fax: (416) 593-4898" & con$ & "Contact: Jerry Moscovitch" & con$ & FA3 CompInfo$(5) = FA1$ & con$ & "Suite 200" & con$ & "58 Abler Drv." & con$ & FA2$ & con$ & "Canada"& con$ &"L4W 4J4"& con$ &"Phone: (905) 602-7986"& con$ &"Fax: (905) 602-7993"& con$ &"Contact: Craig Ferchat" DIM CompanyInfo$ DialogAgain: CompanyInfo = CompInfo(Comp) BEGIN DIALOG Dl 170, 184, "STL Service Bureaus" GROUPBOX 5, 4, 160, 40, "Service Bureau" OKBUTTON 15, 163, 50, 14 CANCELBUTTON 100, 163, 50, 14 GROUPBOX 5, 47, 160, 108, "Service Bureau Information" TEXT 15, 60, 140, 85, CompanyInfo$ PUSHBUTTON 120, 18, 40, 15, "Update" DDLISTBOX 15, 19, 95, 132, Company$, Comp% END DIALOG ret = DIALOG(Dl) If ret = 2 then goto AllDone If ret = 1 then goto AllDone If ret = 3 then goto DialogAgain ' ENDIF AllDONE: END SUB '************************************************************************************************ '************************************************************************************************ '************************************************************************************************ SUB FIN stop END SUB '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** SUB DOSEND DIM CallThing$ FileNamee$ = LEFT(FileName$, INSTR(FileName$, ".STL")-1) MakeFTPFile MakeUserFile ExportSTLFile CallThing = "ftp -i -s:C:\ftpfile.txt" err = WinExec(CallThing$, 1) IF err < 0 THEN err = err * -1 IF err < 33 THEN MESSAGE "Could not find C:\FTPFile.txt. Please find the file on your CorelCAD CD and place it in the appropriate directory." STOP ENDIF end sub '**************************************************************************************************************** '**************************************************************************************************************** SUB DOUPDATE end sub '**************************************************************************************************************** '**************************************************************************************************************** SUB MAKEFTPFILE Dim N1$,N2$,N3$,N4$,N5$,N6$,N7$,N8$,N9$,N10$,N11$ N1= "open " + Complex(Comp,1) N2= Complex(Comp,2) N3= Complex(Comp,3) N4= "cd " + Complex(comp,4) N5= "mput" + " " +"C:\" + FileNamee + "*.STL" N6= "" N7= "" rem Complex(Comp,4) + FileNamee + "*.STL" N8= "put" N9= "C:\" + FileNamee + ".txt" N10= Complex(Comp,4) + "\" +FileNamee + ".txt" N11= "bye" OPEN "C:\ftpfile.txt" FOR OUTPUT AS 1 print #1, N1 print #1, N2 print #1, N3 print #1, N4 print #1, N5 print #1, N6 print #1, N7 print #1, N8 print #1, N9 print #1, N10 print #1, N11 CLOSE 1 END SUB '**************************************************************************************************************** '**************************************************************************************************************** SUB MakeUserFile Dim U1$,U2$,U3$,U4$,U5$,U6$,U7$,U8$,U9$ U1="CUSTOMER NAME:" + UserName$ U2="COMPANY NAME:" + CompanyName$ U3="ADDRESS:" + Address$ U4= "Phone Number:" + PhoneNumber$ U5= "Fax Number:" + FaxNumber$ U6= "E-Mail Address:" + Email$ U7= "STL File Name:" + FileNamee$ + "*.STL" U8= "NOTE:Each solid will be in a seperate File." U9= "Customer Request:" + commentTxt$ OPEN "C:\" + FileNamee$ + ".TXT" FOR OUTPUT AS 2 print #2, U1 Print #2, U2 Print #2, U3 Print #2, U4 Print #2, U5 Print #2, U6 Print #2, U7 Print #2, U8 Print #2, U9 CLOSE 2 end sub '**************************************************************************************************************** '**************************************************************************************************************** SUB ExportSTLFile WITHOBJECT "CorelCAD.Automation.1" .setvisible -1 .FileExport "C:\" & FileName$ END WITHOBJECT end sub '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '**************************************************************************************************************** '****************************************************************************************************************